package org.imsoss.util;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.apache.log4j.Logger;

public class ImsUtils {
	
	private static final Logger logger = Logger.getLogger(ImsUtils.class); 
	
	public void sleep(int sleepTime)
	{
		try{
			Thread.sleep(sleepTime);
		}
		catch(InterruptedException e){			
			e.printStackTrace();			
		}
	}
		
	public String dnsLookUp(String hostName)
	{
		String resolvedAddress = null;
		try
		{
			InetAddress resolver = InetAddress.getByName(hostName);
			resolvedAddress = resolver.getHostAddress();
		}
		catch(UnknownHostException exp)
		{
			logger.error("DNS lookup for the "+hostName+" fails, check if this valid HOSTNAME");			
			exp.printStackTrace();
		}
		return resolvedAddress;
	}
}

